local scene = director:createScene()

function scene:setUp(event)
    dbg.print("sceneScore:setUp")
	
	local allScaleX = 480/director.displayWidth
	local allScaleY = 320/director.displayHeight
	
	file = io.open("scoreTime.txt")
	scoreTimeOne = file:read()
	scoreTimeTwo = file:read()
	scoreTimeThree = file:read()
	file:close()
	
	local labelScoreOne = director:createLabel({x=240/allScaleX, y=280/allScaleY, text="BEST SCORES", hAlignment="center", xAnchor=0.5, color=color.white, xScale=1/allScaleX, yScale=1/allScaleY,})
	local labelScoreThree = director:createLabel({x=240/allScaleX, y=190/allScaleY, text="1-  "..scoreTimeOne,hAlignment="center", xAnchor=0.5, color=color.white, xScale=1/allScaleX, yScale=1/allScaleY,})
	local labelScoreFour = director:createLabel({x=240/allScaleX, y=160/allScaleY, text="2-  "..scoreTimeTwo,hAlignment="center", xAnchor=0.5, color=color.white, xScale=1/allScaleX, yScale=1/allScaleY,})
	local labelScoreFive = director:createLabel({x=240/allScaleX, y=130/allScaleY, text="3-  "..scoreTimeThree,hAlignment="center", xAnchor=0.5, color=color.white, xScale=1/allScaleX, yScale=1/allScaleY,})
	
	local buttonBack = director:createSprite(250/allScaleX, 50/allScaleY, "img/button.png")
	buttonBack.xAnchor=0.5; buttonBack.yAnchor=0.5
	buttonBack.xScale=.5/allScaleX; buttonBack.yScale=.5/allScaleY
	buttonBack.y = buttonBack.y - buttonBack.h/2.5/allScaleY
	labelBack = director:createLabel(250/allScaleX, 0, "Back")
	labelBack.xAnchor=0.5;
	labelBack.zOrder = buttonBack.zOrder
	labelBack. hAlignment="center"
	labelBack.xScale = 1/allScaleX
	labelBack.yScale = 1/allScaleY
	
	function buttonBack:touch(event)
		if (event.phase == 'began') then
			system:sendEvent("moveToSceneMenu")
		end
	end
	buttonBack:addEventListener('touch', buttonBack)
end

function scene:tearDown(event)
    dbg.print("sceneScore:tearDown")
end

scene:addEventListener({"setUp", "tearDown"}, scene)

return scene -- We must return the scene object!